﻿
/*----------------------------------------------------------------//
// 文件名：MoDept.cs
// 文件功能描述：实体 MoDept.
// 
// 创建标识：Template  ver 5.0.20090429 2009-11-20
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoDept
using System;
using System.Data;
namespace EQT.Model
{
    /// <summary>
    /// 业务实体MoDept
    /// </summary>
    public partial class MoDept : ICloneable
    {
        #region 表Dept的字段
        private string deptId;
        private string parentDeptId;
        private string deptName;
        private string deptTel;
        private string deptManagerCode;
        private string rem;
        #endregion

        #region 构造函数
        public MoDept()
        {


        }
        #endregion

        #region 拷贝构造函数

        public MoDept(MoDept item)
        {
            item.CopyTo(this);
        }
        #endregion

        #region 带参数构造函数
        public MoDept(string deptId, string parentDeptId, string deptName, string deptTel, string deptManagerCode, string rem)
        {
            this.deptId = deptId;
            this.parentDeptId = parentDeptId;
            this.deptName = deptName;
            this.deptTel = deptTel;
            this.deptManagerCode = deptManagerCode;
            this.rem = rem;
        }
        #endregion

        #region 表Dept的字段属性
        /// <summary>
        /// DEPT_ID
        /// </summary>
        public string DeptId
        {
            get { return deptId; }
            set { deptId = value; }
        }
        /// <summary>
        /// PARENT_DEPT_ID
        /// </summary>
        public string ParentDeptId
        {
            get { return parentDeptId; }
            set { parentDeptId = value; }
        }
        /// <summary>
        /// DEPT_NAME
        /// </summary>
        public string DeptName
        {
            get { return deptName; }
            set { deptName = value; }
        }
        /// <summary>
        /// DEPT_TEL
        /// </summary>
        public string DeptTel
        {
            get { return deptTel; }
            set { deptTel = value; }
        }
        /// <summary>
        ///此字段来源于人员编码，可以为空。
        /// </summary>
        public string DeptManagerCode
        {
            get { return deptManagerCode; }
            set { deptManagerCode = value; }
        }
        /// <summary>
        /// REM
        /// </summary>
        public string Rem
        {
            get { return rem; }
            set { rem = value; }
        }
        #endregion

        #region 辅助函数
        /// <summary>
        /// 拷贝函数
        /// </summary>
        public MoDept CopyTo(MoDept item)
        {
            item.deptId = this.deptId;
            item.parentDeptId = this.parentDeptId;
            item.deptName = this.deptName;
            item.deptTel = this.deptTel;
            item.deptManagerCode = this.deptManagerCode;
            item.rem = this.rem;
            return item;
        }
        /// <summary>
        /// 克隆函数
        /// </summary>		
        public object Clone()
        {
            MoDept mo = new MoDept();
            mo.DeptId = this.DeptId;
            mo.ParentDeptId = this.ParentDeptId;
            mo.DeptName = this.DeptName;
            mo.DeptTel = this.DeptTel;
            mo.DeptManagerCode = this.DeptManagerCode;
            mo.Rem = this.Rem;
            return mo;
        }
        ///<summary>
        ///判断对象是否相等
        ///<summary>
        public override bool Equals(object obj)
        {
            if (object.ReferenceEquals(this, obj))
            {
                return true;
            }
            else
            {
                MoDept NewDept = obj as MoDept;
                if (NewDept == null)
                {
                    return false;
                }
                else
                {
                    if (NewDept.DeptId == this.DeptId && NewDept.ParentDeptId == this.ParentDeptId && NewDept.DeptName == this.DeptName && NewDept.DeptTel == this.DeptTel && NewDept.DeptManagerCode == this.DeptManagerCode && NewDept.Rem == this.Rem)
                    {
                        return true;
                    }
                }

            }
            return false;

        }
        ///TODO:you should modify GetHashCode by yourself.
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override string ToString()
        {
            return String.Format(System.Globalization.CultureInfo.InvariantCulture, "DeptId={0}/ParentDeptId={1}/DeptName={2}/DeptTel={3}/DeptManagerCode={4}/Rem={5}", deptId, parentDeptId, deptName, deptTel, deptManagerCode, rem);

        }
        #endregion


        #region DataTable Help Function
        ///<summary>
        ///DataRow转换成Model
        ///</summary>
        public void Row2Model(DataRow row)
        {
            if (row["Dept_ID"] != null && row["Dept_ID"] != DBNull.Value)
            {
                this.DeptId = (string)row["Dept_ID"];
            }
            else
            {
                this.DeptId = string.Empty;
            }
            if (row["Parent_Dept_ID"] != null && row["Parent_Dept_ID"] != DBNull.Value)
            {
                this.ParentDeptId = (string)row["Parent_Dept_ID"];
            }
            else
            {
                this.ParentDeptId = string.Empty;
            }
            if (row["Dept_Name"] != null && row["Dept_Name"] != DBNull.Value)
            {
                this.DeptName = (string)row["Dept_Name"];
            }
            else
            {
                this.DeptName = string.Empty;
            }
            if (row["Dept_Tel"] != null && row["Dept_Tel"] != DBNull.Value)
            {
                this.DeptTel = (string)row["Dept_Tel"];
            }
            else
            {
                this.DeptTel = string.Empty;
            }
            if (row["Dept_Manager_Code"] != null && row["Dept_Manager_Code"] != DBNull.Value)
            {
                this.DeptManagerCode = (string)row["Dept_Manager_Code"];
            }
            else
            {
                this.DeptManagerCode = string.Empty;
            }
            if (row["Rem"] != null && row["Rem"] != DBNull.Value)
            {
                this.Rem = (string)row["Rem"];
            }
            else
            {
                this.Rem = string.Empty;
            }
        }

        ///<summary>
        ///Model转换成DataRow
        ///</summary>
        public void Model2Row(DataRow row)
        {
            row["Dept_ID"] = this.DeptId;
            row["Parent_Dept_ID"] = this.ParentDeptId;
            row["Dept_Name"] = this.DeptName;
            row["Dept_Tel"] = this.DeptTel;
            row["Dept_Manager_Code"] = this.DeptManagerCode;
            row["Rem"] = this.Rem;
        }
        #endregion
    }
}
#endregion
